<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>DataGrid Complex Toolbar - jQuery EasyUI Demo</title>
	<script type="text/javascript" src="__PUBLIC__/Resourse/js/jquery-1.8.0.min.js"></script>
	<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/Resourse/js/jquery.cookie.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Resourse/themes/default/easyui.css" id="easyuiTheme">
	<script type="text/javascript" charset="UTF-8" src="__PUBLIC__/Resourse/js/changeEasyuiTheme.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Resourse/themes/icon.css">
	<script type="text/javascript" src="__PUBLIC__/Resourse/js/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Resourse/js/jquery.jqprint-0.3.js"></script>
	<style type="text/css">  
        #studentfm{  
            margin:0;  
            padding:10px 10px 30px 5px;  
       }  
       .ftitle{  
            font-size:14px;  
            font-weight:bold;  
            padding:5px 0;  
            margin-bottom:10px;  
            border-bottom:1px solid #ccc;  
        }  
       .fitem{  
            margin-bottom:0px;  
       }  
        .fitem label{             
            width:120px;  
        }
        .formText {
        	border-left:none; border-right:none; border-top:none; border-bottom: 1 solid #000000;
        	width : 120px;
        } 
        .combo {
		  border-color: rgb(233, 230, 230);
		  background-color: #ffffff;
		} 
		.panel-header,
		.panel-body {
		  border-color: rgb(222, 223, 224);
		}
    </style>  
    <script type="text/javascript">  
      var url; 
      var orderUrl;
      var orderDetailUrl;
      
      //当前时间
      function getNowDate(){
          var curr_time = new Date();
          var strDate = curr_time.getFullYear()+"-";
          if(curr_time.getMonth()+1<10){
        	  strDate += "0"+(curr_time.getMonth()+1)+"-";
          }else{
        	  strDate += curr_time.getMonth()+1+"-";
          }      
          if(curr_time.getDate()<10){
        	  strDate += "0" + curr_time.getDate();
          }else{
        	  strDate += curr_time.getDate();
          }       
          return strDate;
      }
      
      //初始化订单表单
      function initOrderForm(){    	 
    	  $("#DD_SL").val(0);
    	  $("#DD_ZJE").val(0);
    	  $("#DD_YF").val(0);
    	  $("#DD_SF").val(0);
    	  $("#DD_ZK").val(0);
    	//$("#DD_CJSJ").datebox("setValue", getNowDate());
    	  $("input[name='DD_FP'][value=0]").attr("checked",true);
    	  $('#DD_ZFFS').combobox('setValue','ZF6');
    	  $('#DD_DDZT').combobox('setValue','DDZT1');  	  
          //加载报名单明细
          $('#order_details_data').datagrid('loadData', { total: 0, rows: [] });
          $('#DD_DDZT').combobox('disable');
      }
      
      //初始化课程表单
      function initCourseForm(){
          $('#LS_SL').val(1);
          $("#LS_COUNT").val(0);
          $("#LS_ZK").val(0);
          $('#LS_JSMC').combobox('setValue','0');        
          $('#LS_KCLX').combobox('setValue','0');
      }
      
      //添加报名单
      function newOrder(){  
            $('#dlg_order').dialog('open').dialog('setTitle','添加报名信息');  
           	orderUrl = '__URL__/addOrder/';               	
           	$('#orderfm').form('clear');             
           	initOrderForm();                	
       } 
      
      
      //修改报名单
      function editOrder(){  
    	    $('#DD_DDZT').combobox('disable');
    	    var rows = $('#order_list_data').datagrid('getSelections'); 
            if (rows.length == 1){  
               $('#dlg_order').dialog('open').dialog('setTitle','修改报名单');  
               $('#orderfm').form('load',rows[0]);  
                           
               //加载报名单明细
               var queryParams = $('#order_details_data').datagrid('options').queryParams; 
               queryParams.LS_DDBH = $("#DD_BH").val();
               $('#order_details_data').datagrid('reload'); 
               
               orderUrl = '__URL__/saveOrder?id=' + rows[0].Id;  
           }  
       }
      
      //打印报名单
      function printOrder(){
    	//  $('#dlg_order').jqprint();  
    	  $("#printArea").css('display','');
    	  $('#printArea').jqprint({ operaSupport: true });
	      
      }
      
      //添加课程
      function addOrderDetail(){
          $('#dlg_order_detail').dialog('open').dialog('setTitle','添加课程');  
          $('#course_data_list').datagrid('reload'); 
  	 	//设置分页控件  
          var p = $('#course_data_list').datagrid('getPager');  
          $(p).pagination({  
              pageSize: 10,//每页显示的记录条数，默认为10  
              pageList: [1,10,20,30],//可以设置每页记录条数的列表  
              beforePageText: '第',//页数文本框前显示的汉字  
              afterPageText: '页    共 {pages} 页',  
              displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
          }); 
         
      }    
      
      //删除课程
      function destroyOrderDetail(){         
          var rows = $('#order_details_data').datagrid('getSelections'); 
          if(rows.length > 0){
	          	$.messager.defaults.ok = "确定"; //改变默认按钮文字
	        	$.messager.defaults.cancel = "取消"; //改变默认按钮文字
	            $.messager.confirm('确认','确认要删除吗?',function(r){             	
	               if (r){              	   
	            	  var count = 0;            	  
	             	  for(var i = 0;i<rows.length;i++){
	             		 var dd_sl = $('#DD_SL').val();
	             		 var dd_zje = $('#DD_ZJE').val();
	                	  var index = $('#order_details_data').datagrid('getRowIndex', rows[i]);  
	                	  $('#order_details_data').datagrid('deleteRow',index); 
	                	  $('#DD_SL').val(Number(dd_sl)-1);//设置课程数量

	                	  var zje = Number(dd_zje) - Number(rows[i].LS_YFJE) ;
	                	  $('#DD_ZJE').val(zje);//设置总金额
	                	  
	                	  var DD_ZK = $('#DD_ZK').val();//获取折扣金额
	                	  if(DD_ZK!=0){
	                		  if(Number(zje) - Number(DD_ZK)<0){
	                			  $('#DD_YF').val(0);
	                		  }else{
	                			  $('#DD_YF').val(Number(zje) - Number(DD_ZK))//设置应付金额
	                		  }	                		 
	                	  }else{
	                		  $('#DD_YF').val(zje);
	                	  }
	            	  } 
	             	 
	                }  
	            }); 
          }       
      }
      
      //添加课程到gird
      function  addCourseToGrid(course){
       	var zk = course.KC_ZK ;
     	var kcje = course.KC_KCFY ;
     	//根据折扣计算应付金额
   	 	var totalPrice = Number(kcje)*Number(1)*Number(zk*Number(0.1));
    	if(zk == 0){			    		 
    		 totalPrice = Number(kcje);
    	}
    	
   	 	$('#order_details_data').datagrid('appendRow',{ 
			LS_KCBH: course.Id,
			LS_KCMC: course.KC_BJMC,
			LS_KCJG: course.KC_KCFY,
			LS_KCLX: course.KMMC,
			LS_SL: 1,
			LS_JSBH: '',
			LS_JSMC: '',
			LS_ZK: zk,
			LS_YFJE: totalPrice, 
			LS_SRQ: course.KC_SRQ, 			
			LS_STIME: course.KC_STIME, 
			LS_ETIME: course.KC_ETIME
   	  	}); 
      }
      
      //添加课程数据
      function saveOrderDetail(){
        var courses = $('#course_data_list').datagrid('getSelections');   //选中的课程
        var order_details = $('#order_details_data').datagrid('getRows'); //订单中已经报名的课程
                
        var courseName = '';  //已报名的课程
        var isFullCourse = ''; //满员的课程
        var sametimeCourse = '';//课程时间冲突
        
        for(var i=0;i<courses.length;i++){ 
        	var itemCourse = '';
        	var ishava = false;
        	if(order_details.length != 0){ //订单已经报名课程，则需要过滤
                for(var m=0;m<order_details.length;m++){      		 
         		   if(courses[i].Id == order_details[m].LS_KCBH){
         			  courseName += courses[i].KC_BJMC+","; 
         			  ishava = true;
         			  break;
         		   }        		  
            	} 
        	    //判断课程是否在订单中存在
	        	if(!ishava){
	        		//判断课程是否满员
	        		if(Number(courses[i].KC_ZRS) > Number(courses[i].KC_YBRS)){
	        			var isSameTime = 0;
	        			for(var j=0;j<courses.length;j++) { //与选择的课程互相比较
	        				if(courses[i].KC_SRQ == courses[j].KC_SRQ){
	        					isSameTime++;
	        					itemCourse += courses[j].KC_BJMC+","; 
	        				}
	        			}
	        			for(var j=0;j<order_details.length;j++) { //与订单中已报名课程比较
	        				if(courses[i].KC_SRQ == order_details[j].LS_SRQ){
	        					//if()
	        					isSameTime++;
	        					itemCourse += order_details[j].LS_KCMC+","; 
	        				}
	        			}
	        			if(isSameTime == 1){
	        				addCourseToGrid(courses[i]);
	        				itemCourse = '';
	        			} else {      
	        				sametimeCourse += itemCourse +";";
	        			}    
	        		}else{
	        			isFullCourse += courses[i].KC_BJMC+","; 
	        		}	        		
	        	}      
        	}else{ //直接添加课程
        		//判断课程是否满员
        		if(Number(courses[i].KC_ZRS) > Number(courses[i].KC_YBRS)){
        			var isSameTime = 0;
        			for(var j=0;j<courses.length;j++) {
        				if(courses[i].KC_SRQ == courses[j].KC_SRQ){
        					isSameTime++;
        					itemCourse += courses[j].KC_BJMC+","; 
        				}
        			}
        			if(isSameTime == 1){
        				addCourseToGrid(courses[i]);
        				itemCourse = '';
        			} else {      
        				sametimeCourse += itemCourse +";";
        			}      			
        		}else{
        			isFullCourse += courses[i].KC_BJMC+","; 
        		}
        	}       	
        }
        
        //提示已经存在的课程
        if(courseName!=""){
        	alert("对不起，课程  "+courseName.substring(0, courseName.length-1)+" 已经在该订单中 ！")
        }else{
            //提示已经满员的课程
            if(isFullCourse!=""){
            	alert("对不起，课程  "+isFullCourse.substring(0, isFullCourse.length-1)+" 报名人数已满！")     	
            }else{
                //提示时间有冲突的课程
                if(sametimeCourse!=""){
                	sametimeCourse = sametimeCourse.substr(0,sametimeCourse.indexOf(";"));
                	alert("对不起，课程  "+sametimeCourse.substring(0, sametimeCourse.length-1)+" 时间有冲突！")     	
                }else{
                	$('#dlg_order_detail').dialog('close');
                }   
            }
        }            
    	
	    var DD_PPMC = ''; 
	    var DD_PPMC_UNNOMAL = '';//预订订单
	   
	    var DD_ZJE = Number(0);
	    var DD_ZJE_UNNOMAL = Number(0); //预订订单
	    var count = 0;
	    if(order_details.length!=0){ //拼接课程名称，逗号分隔
           for(var i=0;i<order_details.length;i++){
        		   DD_ZJE +=  Number(order_details[i].LS_YFJE);
        		   count++;
           }	           

     	  var DD_ZK = $('#DD_ZK').val();//获取折扣金额
          $('#DD_SL').val(count)//设置课程数量
          $('#DD_ZJE').val(DD_ZJE)//设置总金额
     	  if(DD_ZK!=0){
     		  $('#DD_YF').val(Number(DD_ZJE) - Number(DD_ZK))//设置应付金额
     	  }else{
     		  $('#DD_YF').val(DD_ZJE);
     	  }
	    }
      }      
      
      /**   
      function saveOrderDetail(){	  
   	 if($("#LS_KCMC").combobox('getValue')==""){
    		 return;
    	 }
    	 var ls_count = $('#LS_COUNT').val(); 	 
         if(ls_count == 0){ //课程满员
        	$("#LS_TYPE").val("1");//如果为1表示为预报名订单
         	$.messager.defaults.ok = "确定"; //改变默认按钮文字
        	$.messager.defaults.cancel = "取消"; //改变默认按钮文字
            $.messager.confirm('确认','此课程已满员，是否需要预订该课程?',function(r){             	
               if (r){              	   
            	   addCourseData();
                }else{
                   $('#order_detail_fm').form('clear');  
                   initCourseForm();
                   return ;
                }  
            });	
         }else{
        	$("#LS_TYPE").val("0");//如果为1表示为预报名订单
			if(Number($('#LS_SL').val()) > Number(ls_count)){
				alert("对不起，该课程还剩"+ ls_count +"个名额！");
				return;
			}else {
				 addCourseData();
			}
         }  
      }**/

       //保存报名单
       function saveOrder(){   	   
    	   if($("#orderfm").form('validate')){
    	  	   var rows = $('#order_details_data').datagrid('getRows');  	  	   
    	  	   if(rows.length == 0){
    	  		   alert("请选择要报名的课程!");
    	  		   return;
    	  	   } else {      	  	   
    	        	   var DD_PPMC = '';
	                   for(var i=0;i<rows.length;i++){              	   
   							DD_PPMC += rows[i].LS_KCMC + ',';    	  
	                   }
	                   DD_PPMC = DD_PPMC.substring(0, DD_PPMC.length-1);   
    	        	   var DD_BH = $('#DD_BH').val();
    	        	   var DD_KHBH = $('#DD_KHBH').val();
    	        	   var DD_KHMC = $("#DD_KHMC").combogrid('getText');
    	        	   var DD_FP = $('#DD_FP').val();
    	        	   var DD_FPTT= $('#DD_FPTT').val();
    	        	   var DD_FPNN = $('#DD_FPNN').val();
    	        	   var DD_SL= $('#DD_SL').val();
    	        	   var DD_YF= $('#DD_YF').val();
    	        	   var DD_SF = $('#DD_SF').val();
    	        	   var DD_ZJE = $('#DD_ZJE').val();
    	        	   var DD_ZK = $('#DD_ZK').val();
    	        	   var DD_SYYHQ = $('#DD_SYYHQ').combogrid('getValue');
    	        	   var DD_ZFFS = $("#DD_ZFFS").combobox('getValue');
    	        	   var DD_ZD = $("#DD_ZD").val();
    	        	   var DD_DDZT = $("#DD_DDZT").combobox('getValue');
    	        	   var DD_CJSJ = $('#DD_CJSJ').val();
    	        	   var DD_TJR = $('#DD_TJR').val();
    	        	   var DD_BZ = $('#DD_BZ').val();
    	    		   var courseList = rows;
    	        	   var postParams = {
    	        			   			 DD_BH:DD_BH,
    	        			   			 DD_KHBH:DD_KHBH,
    	        			   			 DD_KHMC:DD_KHMC,
    	        			   			 DD_FP:DD_FP,
    	        			   			 DD_FPTT:DD_FPTT,
    	        			   			 DD_FPNN:DD_FPNN,
    	        			   			 DD_PPMC:DD_PPMC,
    	        			   			 DD_SL:DD_SL,
    	        			   			 DD_YF:DD_YF,
    	        			   			 DD_SF:DD_SF,
    	        			   			 DD_ZJE:DD_ZJE,
    	        			   			 DD_ZK:DD_ZK,
    	        			   			 DD_SYYHQ:DD_SYYHQ,
    	        			   			 DD_ZFFS:DD_ZFFS,
    	        			   			 DD_ZD:DD_ZD,
    	        			   			 DD_DDZT:DD_DDZT,
    	        			   			 DD_CJSJ:DD_CJSJ,
    	        			   			 DD_TJR:DD_TJR,
    	        			   			 DD_BZ:DD_BZ,
    	        			   			 courseList:courseList
    	        			   			};   	  
    	               $.post(orderUrl,postParams,function(result){  
    	            	   console.log(result);
    	                   if (result.success){  
    	                	  $('#orderfm').form('clear'); 
    	                	  $('#dlg_order').dialog('close');      // close the dialog  
    	                      $('#order_list_data').datagrid('reload');    // reload the order data  
    	                   } else {  
    	                      $.messager.show({   // show error message  
    	                           title: '错误',  
    	                           msg: result.errorMsg  
    	                       });  
    	                  }  
    	              },'json'); 
    	  	   }
    	   }
        }   
       
       //删除报名单
        function destroyOrder(){  
           var rows = $('#order_list_data').datagrid('getSelections');  
           var ids = '';
           for(var i=0;i<rows.length;i++){
        	   ids += rows[i].Id + ',';
           }
           ids = ids.substring(0, ids.length-1);//获取所有要删除的ID
            if (rows.length!=0){  
            	$.messager.defaults.ok = "确定"; //改变默认按钮文字
            	$.messager.defaults.cancel = "取消"; //改变默认按钮文字
                $.messager.confirm('确认','确认要删除吗?',function(r){             	
                   if (r){              	   
                      $.post('__URL__/delOrder/',{ids:ids},function(result){  
                            if (result.success){  
                               $('#order_list_data').datagrid('reload');    // reload the user data  
                            } else {  
                               $.messager.show({   // show error message  
                                    title: '错误',  
                                    msg: result.errorMsg  
                                });  
                           }  
                       },'json');  
                    }  
                });  
            }  
       }         
       
       $(window).resize(function(){  
        	$('#order_list_data').datagrid('resize');  
       });   
       
       //设置分页
       $(function(){
    	 	//设置分页控件  
           var p = $('#order_list_data').datagrid('getPager');  
           $(p).pagination({  
               pageSize: 10,//每页显示的记录条数，默认为10  
               pageList: [1,10,20,30],//可以设置每页记录条数的列表  
               beforePageText: '第',//页数文本框前显示的汉字  
               afterPageText: '页    共 {pages} 页',  
               displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
           }); 
           
           //学生combogird
           $('#DD_KHMC').combogrid({
				panelWidth:420,
				idField:'XS_XM', //ID字段
			    textField:'XS_XM', //显示的字段
			    url:"__URL__/studentList/",
			    fitColumns: true,
				striped: true,
				editable:true,
				pagination : true,//是否分页
				rownumbers:true,//序号
				collapsible:false,//是否可折叠的
				fit: true,//自动大小
				method:'post',
				afterPageText: '页    共 {pages} 页',  
			    columns:[[
			        {field:'XS_XM',title:'姓名',width:100},
			        {field:'XS_PY',title:'拼音',width:80},
			        {field:'XS_XH',title:'学号',width:120},
			        {field:'XS_JZXM',title:'家长姓名',width:100}
			    ]],
			    onSelect:function(sel,obj){
			    	$('#DD_KHBH').val(obj.XS_XH);
			    },
				keyHandler: {
		                query: function(q) {
		                    //动态搜索
		                    $('#DD_KHMC').combogrid("grid").datagrid("reload", {'KHMC': q });
		                    $('#DD_KHMC').combogrid("setValue", q);
		                }
		            }
			});
           var dd_khmc_grid=$("#DD_KHMC").combogrid("grid");
           $(dd_khmc_grid).datagrid('getPager').pagination({     
               pageSize: 5,//每页显示的记录条数，默认为10     
               pageList: [5,10],//可以设置每页记录条数的列表     
               beforePageText: '第',//页数文本框前显示的汉字     
               afterPageText: '共 {pages} 页 ',     
               displayMsg: '显示 {from}-{to} 条',   
           });  
           
           //优惠combogird
           $('#DD_SYYHQ').combogrid({
				panelWidth:600,
				idField:'YHK_BH', //ID字段
			    textField:'YHK_BH', //显示的字段
			    url:"__URL__/couponList/",
			    fitColumns: true,
				striped: true,
				editable:true,
				pagination : true,//是否分页
				rownumbers:true,//序号
				collapsible:false,//是否可折叠的
				fit: true,//自动大小
				method:'post',
				afterPageText: '页    共 {pages} 页',  
			    columns:[[
			        {field:'YHK_BH',title:'编号',width:100},
			        {field:'YHK_MC',title:'名称',width:100},
			        {field:'YHK_YHTJ',title:'优惠条件',width:80},
			        {field:'YHK_LX',title:'优惠类型',width:80,formatter:function(value,rowData,rowIndex){ if(value == '1'){ return '减现'} else { return '折扣'}}},
			        {field:'YHK_JE',title:'优惠金额',width:80},
			        {field:'YHK_PPMC',title:'课程名称',width:100},
			        {field:'YHK_KSSJ',title:'开始时间',width:100},
			        {field:'YHK_JSSJ',title:'过期时间',width:100}
			    ]],
			    onSelect:function(sel,obj){
			    	computeCoupon(obj.YHK_LX,obj.YHK_JE); //计算优惠
			    }
			});
           
           var dd_syyhq_grid=$("#DD_SYYHQ").combogrid("grid");
           $(dd_syyhq_grid).datagrid('getPager').pagination({     
               pageSize: 5,//每页显示的记录条数，默认为10     
               pageList: [5,10],//可以设置每页记录条数的列表     
               beforePageText: '第',//页数文本框前显示的汉字     
               afterPageText: '共 {pages} 页 ',     
               displayMsg: '显示 {from}-{to} 条',   
           });   
       });
       
       //是否开发票
       function getRadio(value){
    	  if(value == 1){ //表明开发票
    		  $("#fptt_tr").css('display','');
    		  $("#fpnn_tr").css('display','');
    	  }else{
    		  $("#fptt_tr").css('display','none');
    		  $("#fpnn_tr").css('display','none');
    	  }   	  
       }
       
       //计算课程优惠
       function discountCourse(ls_zk){
    	     if(ls_zk != 0){
        	     var LS_KCJG = $("#LS_KCJG").val();//课程价格
    	    	 var totalPrice = Number(LS_KCJG)*Number($("#LS_SL").val())*Number($("#LS_ZK").val()*Number(0.1));
    	    	 $("#LS_YFJE").val(totalPrice.toFixed(2));   	    	 
    	     }
       }   
       
       //根据优惠编号计算优惠
       function  computeCoupon(YHK_LX,YHK_JE){
     	  var DD_ZJE = Number($("#DD_ZJE").val());//总金额
     	  if(DD_ZJE != 0){
         	  var DD_YF = DD_ZJE;//应付
         	  var DD_ZK = Number(0);//折扣
         	  if(YHK_LX == 'YHKLX01'){ //直接减现
         		 DD_ZK = Number(YHK_JE);
         		 DD_YF = DD_ZJE - DD_ZK;
         	  }else{
         		 DD_ZK = DD_ZJE*(Number(100)-Number(YHK_JE)*10)*0.01;
         		 DD_YF = DD_ZJE - DD_ZK;
         	  }
              $("#DD_ZK").val(DD_ZK);
              $("#DD_YF").val(DD_YF);//课程价格 
     	  }         
       }
       
       //根据条件查询订单信息
       function searchOrder(){   	   
   		   var queryParams = $('#order_list_data').datagrid('options').queryParams; 
   		   queryParams.DD_BH = $("#DD_BH_SEARCH").val();
   		   queryParams.DD_KHBH = $("#DD_KHBH_SEARCH").val();  	   
   		   queryParams.DD_KHMC = $("#DD_KHMC_SEARCH").val();
   		   queryParams.DD_PPMC = $("#DD_PPMC_SEARCH").val();
   		   
   		   $('#order_list_data').datagrid('options').queryParams = queryParams; 
   		   $('#order_list_data').datagrid('reload'); 
       }
       
    </script>  
</head>
<body class="easyui-layout" style="border-width:50px;margin:0">
	<div id="mainPanle"  region="center"  border="false" >
	<table id ="order_list_data" class="easyui-datagrid" style="overflow: hidden;height:auto;margin:0"
			data-options="title:'报名单列表',border:true,striped:true,nowrap:false,fit:true,rownumbers:true,pagination:true,singleSelect:false,url:'__URL__/readOrder/',toolbar:'#tb'" >
		<thead>
			<tr>
				<th data-options="field:'checkbox',checkbox:true" id="checkedAll"></th>	
				<th data-options="field:'DD_BH',fitColumns: true,width:120,align:'left'">报名单号</th>
				<th data-options="field:'DD_KHBH',fitColumns: true,width:100,align:'left'">学生编号</th>
				<th data-options="field:'DD_KHMC',fitColumns: true,width:80,align:'left'">学生名称</th>
				<th data-options="field:'DD_PPMC',fitColumns: true,width:280,align:'left'">课程名称</th>
				<th data-options="field:'DD_SL',fitColumns: true,width:60,align:'left'">课程数量</th>
				<th data-options="field:'DD_ZJE',itColumns: true,width:60,align:'left'">总金额 </th>
				<th data-options="field:'DD_ZK',itColumns: true,width:60,align:'left'">折扣金额</th>
				<th data-options="field:'DD_YF',itColumns: true,width:60,align:'left'">应付 </th>
				<th data-options="field:'DD_SF',itColumns: true,width:60,align:'left'">实付</th>
				<th data-options="field:'DD_ZFFS',itColumns: true,width:80,align:'left',hidden:true">支付方式</th>
				<th data-options="field:'ZFFS',itColumns: true,width:80,align:'left'">支付方式</th>
				<th data-options="field:'DD_ZD',itColumns: true,width:100,align:'left',hidden:true">订单来源</th>
				<th data-options="field:'ZD',itColumns: true,width:100,align:'left'">订单来源</th>				
				<th data-options="field:'DD_CJSJ',itColumns: true,width:130,align:'left'">时间</th>
				<th data-options="field:'DD_CJRMC',itColumns: true,width:80,align:'left'">创建人</th>
				<th data-options="field:'DD_DDZT',itColumns: true,width:70,align:'left',hidden:true">状态</th>
				<th data-options="field:'DDZT',itColumns: true,width:70,align:'left'">状态</th>
			</tr>
		</thead>
	</table>
	<div id="tb" style="padding:0px;height:auto">
		<!--  <div style="margin-bottom:0px">
		<table>
			<tr>
				<td><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newOrder()">添加</a>  </td>
				<td><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editOrder()">修改</a> </td>
				<td><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyOrder()">删除</a></td>
			</tr>  
			</table>
		</div>-->
		<div>
			<form id="stu_search_form" method="post" novalidate> 
			<table cellspacing="5">
				<tr>
					<td>
					     <div class="fitem">  
			                <label>报名单号:</label>  
							<input name="DD_BH_SEARCH" id="DD_BH_SEARCH" class="easyui-validatebox searchText" >
			          	 </div>
					</td>
					<td>
						<div class="fitem">  
			                <label>学号:</label>  
							<input class="easyui-validatebox searchText" id="DD_KHBH_SEARCH" name="DD_KHBH_SEARCH" >
			          	 </div>
					</td>
					<td>
						<div class="fitem">  
		                	<label>学生姓名:</label>  
							<input class="easyui-validatebox searchText" id="DD_KHMC_SEARCH" name="DD_KHMC_SEARCH" >
		           		</div>
					</td>
					<td>
						<div class="fitem">  
			                <label>报名课程:</label>  
							<input name="DD_PPMC_SEARCH" id="DD_PPMC_SEARCH" class="easyui-validatebox searchText" >
			          	 </div>
					</td>
					<td>
					<a href="javascript:searchOrder()" class="easyui-linkbutton" iconCls="icon-search">查询</a>
					</td>
				</tr>
			</table>			
			</form>
		</div>
	</div>
	</div>
	
	<!-- 报名单信息 -->
	<div id="dlg_order" class="easyui-dialog" style="width:960px;height:470px;padding:5px;" data-options="iconCls:'icon-save',resizable:true,modal:true"
            closed="true" buttons="#dlg_order_buttons">  
        <div class="ftitle">报名信息</div>  
        <form id="orderfm" method="post" novalidate>  
        <input name="Id" id="Id" class="easyui-validatebox formText" type="hidden">  
        <input name="DD_BH" id="DD_BH" class="easyui-validatebox formText" type="hidden">
        <input name="DD_ZD" id="DD_ZD" class="easyui-validatebox formText" type="hidden">    
        <input name="DD_CJSJ" id="DD_CJSJ" class="easyui-validatebox formText" type="hidden">      
            <table cellspacing="10">
            <tr>
	           <!--<td>            
		             <div class="fitem">  
		                <label>报名单号:</label>  
		                <input name="DD_BH" class="easyui-validatebox formText">      
		            </div>   
	            </td>-->
	            <td>            
		            <div class="fitem">  
		                <label>学生姓名:</label>  
		                <input name="DD_KHMC" id="DD_KHMC" class="easyui-combogrid formText"  style ="width:120px" required="true" missingMessage="不能为空" >  
		            </div>    
	            </td>
	            <td>           
		             <div class="fitem">  
		                <label>学生学号:</label>  
		               <input name="DD_KHBH" class=" easyui-validatebox formText" id= "DD_KHBH" readOnly="readOnly">  
		            </div>  
	            </td>
	            <td colspan ="2">            
		           <div class="fitem">  
		                <label>发票:</label>  
		                <INPUT type="radio" name="DD_FP" id= "DD_FP" value="0"   onclick="getRadio(this.value)">不开
		                <INPUT type="radio" name="DD_FP" id= "DD_FP" value="1"  onclick="getRadio(this.value)">开						
		           </div> 
	            </td>              
            </tr>  
            <tr id="fptt_tr" style="display:none">
            <td colspan="4">           
		           <div class="fitem">  
		                <label>发票抬头:</label>  
						<input name="DD_FPTT" id="DD_FPTT" class="easyui-validatebox formText"  style ="width:750px"> 
		           </div>
	            </td>                                 
            </tr>  
            <tr id="fpnn_tr" style="display:none">
            	<td colspan="4">           		
		           <div class="fitem">  
		                <label>发票内容:</label>  
						<input name="DD_FPNN" id="DD_FPNN" class="easyui-validatebox formText" style ="width:750px"> 
		           </div>   
	            </td> 
            </tr> 

            <tr>  
               <td>           
		           <div class="fitem">  
		                <label>课程数量:</label>  
						<input name="DD_SL" id="DD_SL" class="easyui-validatebox formText"  readOnly="readOnly">
		           </div>
	            </td>
	            <td>           
		           <div class="fitem">  
		                <label>总&nbsp;金&nbsp;额:</label>  
						<input name="DD_ZJE" id="DD_ZJE" class="easyui-validatebox formText"  readOnly="readOnly">
		           </div>  
	            </td>	           
	            <td>            		
		            <div class="fitem">  
		                <label>优惠编号:</label>  
		                <input name="DD_SYYHQ" id="DD_SYYHQ" class="easyui-combogrid formText" >  
		            </div> 
	            </td>
	             <td>           
		            <div class="fitem">
		                <label>折扣金额:</label>  
						<input class="easyui-validatebox formText"  id="DD_ZK" name="DD_ZK" readOnly="readOnly">
		           </div>   
	            </td>
            </tr>
            <tr>
            	<td>           
		            <div class="fitem">
		                <label>应&nbsp;&nbsp;&nbsp;&nbsp;付:</label>  
						<input class="easyui-validatebox formText"  id ="DD_YF" name="DD_YF"  readOnly="readOnly">
		           </div>
	            </td>
	            <td>            		
		            <div class="fitem">
		                <label>实&nbsp;&nbsp;&nbsp;&nbsp;付:</label>  
						<input class="easyui-validatebox formText"  id="DD_SF" name="DD_SF">
		           </div> 
	            </td>	
	            <td>           
		           <div class="fitem">  
		                <label>支付方式:</label>  
						<input class="easyui-combobox formText" id="DD_ZFFS" name="DD_ZFFS" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList?type=ZFFS'" > 
		           </div>
	            </td> 
	            <td>            
		           <div class="fitem">  
		                <label>订单状态:</label>  
						<input class="easyui-combobox formText" id="DD_DDZT" name="DD_DDZT" data-options="valueField:'ITEM_KEY',textField:'text',url:'__URL__/getDictList?type=DDZT'" editable="false">
		           </div>
	            </td>	            

            </tr>      
            <tr>	
	            <td colspan="1">            		
		            <div class="fitem">
		                <label>推&nbsp;荐&nbsp;人:</label>  
						<input class="easyui-combobox formText"  name="DD_TJR" id="DD_TJR" data-options="valueField:'id',textField:'text',url:'__URL__/getUserList/type/yg3'">
		            </div> 
	            </td>  	
	            <td colspan="3">           
		           <div class="fitem">
		                <label>备&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
		                <input class="easyui-validatebox formText"  name="DD_BZ" id="DD_BZ" style ="width:420px">
		               <!-- <textarea name="DD_BZ" style="height:60px;width:200px"></textarea> --> 
		            </div>  
	            </td>	
	       </tr> 
	        <tr>
            	<td colspan="5"> 
            	<div class="ftitle">报名课程明细</div>
	            	<div id="tb_orderDetail" style="padding:0px;height:auto;background:white">
					<div style="margin-bottom:0px">
					<table>
						<tr>
							<td><a href="javascript:void(0)" class="easyui-linkbutton"  iconCls="icon-add" plain="true" onclick="addOrderDetail()">添加课程</a>  </td>
							<!--<td><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editOrderDetail()">修改课程</a> </td>  -->
							<td><a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyOrderDetail()">删除课程</a></td>
						</tr>  
						</table>
					</div>
					</div>           	
            	</td>
            
            </tr>
            <tr>
	            <td colspan="5">
		       		<table id ="order_details_data" class="easyui-datagrid" style="overflow: hidden;height:auto;margin:0"
					data-options="rownumbers:false,pagination:false,singleSelect:false,url:'__URL__/readOrderDetails/',rowStyler:function(index,row,css){if(row.LS_TYPE=='1'){
					return 'color:red;font-weight:bold;'}}" >
						<thead>
						<tr>
							<th data-options="field:'LS_KCBH',fitColumns: true,width:80,align:'center',hidden:true">课程编号</th>
							<th data-options="field:'LS_KCMC',fitColumns: true,width:80,align:'center'">课程名称</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:80,align:'center'">课程价格</th>
							<th data-options="field:'LS_KCLX',fitColumns: true,width:80,align:'center'">课程类型</th>
							<th data-options="field:'LS_JSMC',itColumns: true,width:120,align:'center',hidden:true">教室名称</th>
							<th data-options="field:'LS_ZK',itColumns: true,width:60,align:'center'">折扣</th>
							<th data-options="field:'LS_SL',itColumns: true,width:80,align:'center'">报名人数</th>
							<th data-options="field:'LS_YFJE',itColumns: true,width:80,align:'center'">应付金额</th>
							<th data-options="field:'LS_SRQ',itColumns: true,width:80,align:'center',hidden:true">上课日期</th>
							<th data-options="field:'LS_STIME',itColumns: true,width:60,align:'center',hidden:true">上课时间</th>
							<th data-options="field:'LS_ETIME',itColumns: true,width:60,align:'center',hidden:true">下课时间</th>
						</tr>
						</thead>
					</table>
	            </td>
            </tr>                                                                  
            </table>            
        </form>  
    </div>  
    <div id="dlg_order_buttons">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveOrder()">保存</a> 
        <!--<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-print" onclick="printOrder()">打印</a>   -->  
       <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_order').dialog('close')">关闭</a>  
    </div>
    
    
  	<!-- 报名单课程 --> 
  	<div id="dlg_order_detail" class="easyui-dialog" style="width:760px;height:0px;padding:10px 20px" data-options="resizable:true,modal:true" 
            closed="true" buttons="#dlg_order_detail_buttons">  
	    <div class="ftitle">课程列表</div>
		<table id="course_data_list" class="easyui-datagrid" style="width:720px;height:450px"  data-options="border:true,striped:true,nowrap:false,fit:true,rownumbers:true,pagination:true,singleSelect:false,url:'__URL__/getCourseList/'" >  
		    <thead>  
		        <tr>  
		       	    <th data-options="field:'checkbox',checkbox:true" id="checkedAllCourse"></th>
					<th data-options="field:'Id',fitColumns: true,hidden:true">Id</th>
					<th data-options="field:'KC_BJMC',itColumns: true,width:100,align:'center'">课程名称</th>
					<th data-options="field:'KC_KCFY',itColumns: true,width:80,align:'center'">课程价格</th>
					<th data-options="field:'KMBH',itColumns: true,width:80,hidden:true,align:'center'">科目编号</th>	
					<th data-options="field:'KMMC',itColumns: true,width:80,align:'center'">科目</th>					
					<th data-options="field:'KC_ZRS',itColumns: true,width:60,align:'center'">总人数</th>
					<th data-options="field:'KC_YBRS',itColumns: true,width:60,align:'center'">已报人数</th>
					<th data-options="field:'KC_ZK',itColumns: true,width:60,align:'center'">折扣</th>
					<th data-options="field:'KC_SRQ',itColumns: true,width:80,align:'center'">上课日期</th>
					<th data-options="field:'KC_STIME',itColumns: true,width:60,align:'center'">上课时间</th>
					<th data-options="field:'KC_ETIME',itColumns: true,width:60,align:'center'">下课时间</th>
		        </tr>  
		    </thead>  
		</table>  
    </div>     
    
    <div id="dlg_order_detail_buttons">  
      <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveOrderDetail()">确定</a>   
      <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_order_detail').dialog('close')">取消</a>  
   </div>
   
   <DIV ID="printArea" style="display:none">
   <div style="font-size:20px;font-weight:bold; padding:5px 0;margin-bottom:15px;border-bottom:1px solid #ccc;text-align :center;margin-top:30px">知音学校收据</div>
        <table width="100%" cellpadding="0" border="0">
            <tr>
	            <td>            
		            <div class="fitem">  
		                <label>收费日期:</label>  
		                <input name="DD_KHMC1" id="DD_KHMC1" value="2013-08-09" style="border-left:none; border-right:none; border-top:none; border-bottom: 1 solid #000000;width:100px" >  
		            </div>    
	            </td>
	            <td style="padding:0px 0px 5px 280px;border:0px;">           
		             <div class="fitem">  
		                <label>订单号:</label>  
		               <input name="DD_KHBH1" id="DD_KHBH1" value="WCXQ201306001" style="border-left:none; border-right:none; border-top:none; border-bottom: 1 solid #000000;width:100px">  
		            </div>  
	            </td>         
            </tr>    
            <tr>
	            <td>            
		            <div class="fitem">  
		                <label>学生姓名:</label>  
		                <input name="DD_KHMC1" id="DD_KHMC1" value="张有强" style="border-left:none; border-right:none; border-top:none; border-bottom: 1 solid #000000;width:100px" >  
		            </div>    
	            </td>
	            <td style="padding:0px 0px 5px 280px;border:0px;">           
		             <div class="fitem">  
		                <label>经手人:</label>  
		               <input name="DD_KHBH1" id="DD_KHBH1" value="张三" style="border-left:none; border-right:none; border-top:none; border-bottom: 1 solid #000000;width:100px">  
		            </div>  
	            </td>         
            </tr> 
            <tr align="left">
	            <td colspan="2" style="padding:10px 0px 10px 0px;" >
		       		<table width="100%" border="1" cellpadding="5" cellspacing="0px" style="border-collapse:collapse">
						<thead>
						<tr align="left">
							<th data-options="field:'LS_KCMC',fitColumns: true,width:150,align:'center'">课程名称</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">单位</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">数量</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">单价</th>
							<th data-options="field:'LS_ZK',itColumns: true,width:100,align:'center'">折扣</th>
							<th data-options="field:'LS_YFJE',itColumns: true,width:100,align:'center'">应付金额</th>
						</tr>
						<tr align="left">
							<th data-options="field:'LS_KCMC',fitColumns: true,width:150,align:'center'">奥数培训</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">期</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">1</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">1000</th>
							<th data-options="field:'LS_ZK',itColumns: true,width:100,align:'center'">100</th>
							<th data-options="field:'LS_YFJE',itColumns: true,width:100,align:'center'">900</th>
						</tr>
						<tr align="left">
							<th data-options="field:'LS_KCMC',fitColumns: true,width:150,align:'center'">英语口语</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">期</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">1</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'">2000</th>
							<th data-options="field:'LS_ZK',itColumns: true,width:100,align:'center'">200</th>
							<th data-options="field:'LS_YFJE',itColumns: true,width:100,align:'center'">1800</th>
						</tr>
						<tr align="left">
							<th data-options="field:'LS_KCMC',fitColumns: true,width:150,align:'center'">合计</th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'"></th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'"></th>
							<th data-options="field:'LS_KCJG',fitColumns: true,width:100,align:'center'"></th>
							<th data-options="field:'LS_ZK',itColumns: true,width:100,align:'center'">300</th>
							<th data-options="field:'LS_YFJE',itColumns: true,width:100,align:'center'">2700</th>
						</tr>
						</thead>
					</table>
	            </td>
            </tr>  
	       <tr>
	       <td></td>
	       	  <td style="padding:0px 0px 0px 280px;border:0px;">           
		           <div class="fitem">
		                <label>收款金额:</label>
		                <input name="DD_KHMC1" id="DD_KHMC1" value="2000.00" style="border-left:none; border-right:none; border-top:none; border-bottom: 1 solid #000000;width:100px" >  
		            </div>  
	            </td>	
	       </tr>                                                                                  
            </table>  
        </DIV>
</body>
</html>